package cn.edu.scau.cmi.chenyuanying.spring.view;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.chenyuanying.orm.dao.StudentDAO;
import cn.edu.scau.cmi.chenyuanying.orm.dao.TeacherDAO;
import cn.edu.scau.cmi.chenyuanying.orm.hibernate.HibernateController;
import cn.edu.scau.cmi.chenyuanying.spring.util.ApplicationContextUtil;

public class SpringHibernateController extends HibernateController {
	@Override
	public void initDAO() {
		System.out.println("使用Spring管理DAO对象");		
		ApplicationContext applicationContext = ApplicationContextUtil.getApplicationContext();
		this.tdao = (TeacherDAO) applicationContext.getBean("teacherDAO");
		this.sdao = (StudentDAO) applicationContext.getBean("studentDAO");
	}
}
